package org.whuims.pois.model;

import org.apache.struts.action.ActionForm;

import javax.persistence.*;

/**
 * Created by zhongwei on 2014/5/13.
 */
@Entity
@Table(name = "wordlist")
public class Wordlist extends ActionForm {
    private long id;
    private String keyword;
    private Integer importance;
    private Integer category;
    private Long topicid;


    @Column(name = "keyword")
    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    @Id
    @Column(name = "id")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "topicid")
    public Long getTopicid() {
        return topicid;
    }

    public void setTopicid(Long topicId) {
        this.topicid = topicId;
    }

    @Basic
    @Column(name = "importance")
    public Integer getImportance() {
        return importance;
    }

    public void setImportance(Integer importance) {
        this.importance = importance;
    }

    @Basic
    @Column(name = "category")
    public Integer getCategory() {
        return category;
    }

    public void setCategory(Integer category) {
        this.category = category;
    }

    public Wordlist(String keyword, Integer importance, Integer category) {
        this.keyword = keyword;
        this.importance = importance;
        this.category = category;
    }

    public Wordlist() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Wordlist wordList = (Wordlist) o;

        if (category != null ? !category.equals(wordList.category) : wordList.category != null) return false;
        if (importance != null ? !importance.equals(wordList.importance) : wordList.importance != null) return false;
        if (keyword != null ? !keyword.equals(wordList.keyword) : wordList.keyword != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = keyword != null ? keyword.hashCode() : 0;
        result = 31 * result + (importance != null ? importance.hashCode() : 0);
        result = 31 * result + (category != null ? category.hashCode() : 0);
        return result;
    }
}
